package com.usian.user.controller;

import com.usian.apis.admin.AuthControllerApi;
import com.usian.common.constant.user.UserConstants;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth/api/v1")
public class AuthController implements AuthControllerApi {
    @Autowired
    private AuthService authService;

    @PostMapping("/list")
    @Override
    public ResponseResult loadListByStatus(@RequestBody AuthDto authDto) {
        return authService.loadListByStatus(authDto);
    }
    @PostMapping("/authPass")
    @Override
    public ResponseResult authPass(@RequestBody AuthDto authDto) {
        return authService.updateStatusById(authDto, UserConstants.PASS_AUTH);
    }
    @PostMapping("/authFail")
    @Override
    public ResponseResult authFail(@RequestBody AuthDto authDto) {
        return authService.updateStatusById(authDto, UserConstants.FAIL_AUTH);
    }
}
